package com.zl.data.db;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Arrays;

/**
 * @author ZL @朱林</a>
 * @Version 1.0
 * @Description TODO
 * @date 2021/01/08  15:37
 */
public class DataBean  implements Parcelable {
    private int id;
    private String key;
    private byte[] value;

    public DataBean() {
    }

    public DataBean(String key, byte[] value) {
        this.key = key;
        this.value = value;
    }

    public DataBean(int id, String key, byte[] value) {
        this.id = id;
        this.key = key;
        this.value = value;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public byte[] getValue() {
        return value;
    }

    public void setValue(byte[] value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return "DataBean{" +
            "id=" + id +
            ", key='" + key + '\'' +
            ", value=" + Arrays.toString(value) +
            '}';
    }

    protected DataBean(Parcel in) {
        id = in.readInt();
        key = in.readString();
        value = in.createByteArray();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeString(key);
        dest.writeByteArray(value);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<DataBean> CREATOR = new Creator<DataBean>() {
        @Override
        public DataBean createFromParcel(Parcel in) {
            return new DataBean(in);
        }

        @Override
        public DataBean[] newArray(int size) {
            return new DataBean[size];
        }
    };
}
